<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<!DOCTYPE HTML>
<html>
	<head>
		<%@ include file="/common/include/title.jsp"%>
		<script type="text/javascript" src="${rootPath }/lib/My97DatePicker/WdatePicker.js"></script>
		
		<title>分类管理 - 商城后台</title>
	</head>
	<body>
		<nav class="breadcrumb">
			<i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>
			产品管理 <span class="c-gray en">&gt;</span> 分类管理 <a
				class="btn btn-success radius r mr-20"
				style="line-height: 1.6em; margin-top: 3px"
				href="javascript:location.replace(location.href);" title="刷新"><i
				class="Hui-iconfont">&#xe68f;</i></a>
		</nav>
		<div class="pd-20">
			<div class="text-c">
				<form class="Huiform" method="post" action="${rootPath }/back/goods/categoryList.htm" target="_self">
					<input type="text" name="keyword" placeholder="关键字" value="${requestScope.keyword }" class="input-text"
						style="width: 120px"> 
					
					<span class="select-box" style="width: 80px"> 
						<select class="select" name="status" size="1">
							<option value="1" ${requestScope.status == '1' ? 'selected' : '' }>启用</option>
							<option value="0" ${requestScope.status == '0' ? 'selected' : '' }>禁用</option>
						</select>
					</span>
					<input type="text" name="st" value="${requestScope.st }" class="input-text"
						style="width: 160px" placeholder="起始时间" 
						onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">
					==>
					<input type="text" name="st" value="${requestScope.st }" class="input-text"
						style="width: 160px" placeholder="结束时间" 
						onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})">
						
					<button type="submit" class="btn btn-success" id="" name="" >搜索</button>
				</form>
			</div>
			<div class="cl pd-5 bg-1 bk-gray mt-20">
				<span class="l">
				<a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i>
						批量删除</a>                                                                         <!-- 从上面点击添加的可定是根节点,所以给个父节点Id为0 -->
				<a href="#" class="btn btn-primary radius" onclick="category_add('分类添加','${rootPath}/back/goods/categoryInsert.htm?parentId=0')" >分类添加</a>
				<a href="#" class="btn btn-primary radius" onclick="category_add('树形菜单','${rootPath}/back/goods/categoryTreeList.htm')" >树形菜单</a>
				</span> 
				<span class="r">
				共有数据：<strong>54</strong> 条
				</span>
			</div>
			<!-- 列表 -->
			<div class="mt-20">
				<table class="table table-border table-bordered table-bg table-sort">
					<thead>
						<tr class="text-c">
							<th width="25"><input type="checkbox" name="" value=""></th>
							<th width="70">ID</th>
							<th width="80">管理员</th>
							<th width="120">上一级</th>
							<th width="120">名称</th>
							<th width="120">Url</th>
							<th width="80">状态</th>
							<th width="120">创建时间</th>
							<th width="120">更新时间</th>
							<th width="120">发布时间</th>
							<th width="100">操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${requestScope.goodsCategoryList }" var="goodsCategory"
						varStatus="stat">
							<tr class="text-c">
								<td><input name="" type="checkbox" value=""></td>
								<td>${goodsCategory.id }</td>
								<td>${goodsCategory.admins.trueName }</td>
								<td>${goodsCategory.parentCategory.name }</td>
								<td>${goodsCategory.name }</td>
								<td class="text-l">
									<a href="${goodsCategory.url }" target="_blank">${goodsCategory.url }</a>
								</td>
								<td class="text-l">${goodsCategory.statusStr }</td>
								<td><fmt:formatDate value="${goodsCategory.createTime }" 
								pattern="yyyy-MM-dd HH:mm:ss"/></td>
								<td><fmt:formatDate value="${goodsCategory.updateTime }" 
								pattern="yyyy-MM-dd HH:mm:ss"/></td>
								<td><fmt:formatDate value="${goodsCategory.pubTime }" 
								pattern="yyyy-MM-dd HH:mm:ss"/></td>
								<td class="f-14 product-category-manage">
									<a style="text-decoration: none"
										onClick="category_add('添加子节点','${rootPath}/back/goods/categoryInsert.htm?parentId=${goodsCategory.id }','1')"
										href="javascript:;" title="添加子节点">
										<i class="Hui-iconfont">&#xe6df;</i>
									</a>
									<a style="text-decoration: none"
										onClick="category_update('分类编辑','${rootPath}/back/goods/categoryUpdate.htm?cid=${goodsCategory.id }','1')"
										href="javascript:;" title="编辑">
										<i class="Hui-iconfont">&#xe6df;</i>
									</a>
									<a style="text-decoration: none" class="ml-5"
										onClick="active_del(this,'10001')" href="javascript:;" title="删除">
										<i class="Hui-iconfont">&#xe6e2;</i>
									</a>
								</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				<!-- 分页 -->
				<form action="${rootPath }/back/goods/categoryList.htm" method="post" id="pageForm">
					<!-- 使用隐藏标签储存参数 -->
					<input type="hidden" name="keyword" value="${requestScope.keyword }">
					<input type="hidden" name="status" value="${requestScope.status }">
					<input type="hidden" name="st" value="${requestScope.st }">
					<input type="hidden" name="ed" value="${requestScope.ed }">
					<div class="dataTables_info" id="DataTables_Table_0_info" role="status"
							aria-live="polite">共${requestScope.pageInfoUtil.totalPage }页
							<a href="#" onclick="return pageInfoSubmit('pageForm','currentPage','1','pageSize','${requestScope.pageInfoUtil.pageSize }')">首页</a>
							<a href="#" onclick="return pageInfoSubmit('pageForm','currentPage','${requestScope.pageInfoUtil.prePage }','pageSize','${requestScope.pageInfoUtil.pageSize }')">上一页</a>
							<a href="#" onclick="return pageInfoSubmit('pageForm','currentPage','${requestScope.pageInfoUtil.nextPage }','pageSize','${requestScope.pageInfoUtil.pageSize }')">下一页</a>
							<a href="#" onclick="return pageInfoSubmit('pageForm','currentPage','${requestScope.pageInfoUtil.totalPage }','pageSize','${requestScope.pageInfoUtil.pageSize }')">尾页</a>
							第<input type="text" name="currentPage" id="currentPage" value="${requestScope.pageInfoUtil.currentPage }" size="5"/>页
							每页<input type="text" name="pageSize" id="pageSize" value="${requestScope.pageInfoUtil.pageSize }" size="5"/>条
							<input type="submit" value="GO"/>
					</div>
				</form>
			</div>
		</div>
	</body>
</html>

<script type="text/javascript">
/*分类-添加*/
function category_add(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}

/*分类-更新*/
function category_update(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}

</script>
